<template>
   <div>
      <h1>$store方式访问vuex模块</h1>
      <div>{{$store.state.counterKey.count}}</div>
      <div style="color:red">{{$store.getters['counterKey/doubleCount']}}</div>
      <button @click="add">通过+2</button>
      <button @click="addAsync">异步+5</button>
   </div>
</template>

<script>
export default {
    methods:{
        add(){
            this.$store.commit('counterKey/INCREMENT_COUNT',2)
        },
        addAsync(){
            this.$store.dispatch('counterKey/incrementAsync',5)
        }
    }
}
</script>

<style>

</style>